package com.fxhy.controller;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.fxhy.bean.custom.AgentUserCustom;
import com.fxhy.service.UserService;

import io.swagger.annotations.Api;

@Controller
@Api(value="邀请注册接口")
@RequestMapping("regist")
public class RegistApi {
	@Autowired
	private UserService userService;
	
	/**
     * 进入填写手机号的页面
     * @param map
     * @param request
     * @return
     */
    @RequestMapping("toRegist")
    public String toRegist(HashMap<String, Object> map,HttpServletRequest request) {
    	String inviteCode = request.getParameter("inviteKey");
    	//查询用户是否存在
    	AgentUserCustom agent = userService.findByInviteCode(inviteCode);
        map.put("inviteCode", inviteCode);  //邀请人的邀请码
        map.put("headImg", agent.getHeadImgUrl());   //邀请人的头像
        map.put("userName", agent.getNickName());    //邀请人的昵称
        map.put("companyName", agent.getCompanyName());    //邀请人的昵称
        return "setPhone";
    }
}
